const router = require('koa-router')()
const { getToken, Updateurl } = require('../../config/databaseapi.js')

// 审核帖子接口
router.post('/audittopic', async (ctx) => {
  console.log('调用审核帖子接口')
  console.log(ctx.request.body);
  let { _id, status, remark } = ctx.request.body;
  let data = {status,remark}
  // console.log('data',data);
  let query = `db.collection("topic").doc({"${_id}"}).update({data:${JSON.stringify(data)})`;
  // console.log('query',query)
  const res = await new getToken().posteve(Updateurl,query);
  console.log(res)
  // if(res.errcode===0){
  //   ctx.body = {msg:"审核成功",status:1}
  // }else{
  //   ctx.body = {msg:"审核失败",status:0}
  // }
})

module.exports = router.routes()